import dotenv from 'dotenv'
import mongoose from 'mongoose'

dotenv.config()

export const connectDB = async () => {
  try {
    const conn = await mongoose.connect(process.env.MONGODB_URI!)
    console.log(`MongoDB Connected: ${conn.connection.host}`)
  } catch (error) {
    console.error('Database connection failed:', error)
    process.exit(1)
  }
}
